package cn.zeal4j.model;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;

/**
 * @author Administrator
 * @file IntelliJ IDEA Hibernate-Tutorial
 * @create 2020 09 26 19:10
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class PageModel<Entity> {
    private Integer pageIndex;
    private Integer pageSize;
    private Long totalCount;
    private Integer totalPage;
    private List<Entity> pageList;

    public void setTotalPage(Long totalCount) {
        totalPage = new Long((totalCount % pageSize == 0) ?
                (totalCount / pageSize) : (totalCount /pageSize + 1)).intValue();
    }
}
